<!DOCTYPE html>
<html style="overflow: hidden;">
<php>
    $_admin_setting=cmf_get_option('admin_settings');
    $_is_mobile=cmf_is_mobile();
</php>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <meta charset="utf-8">
    <title>{$_admin_setting.admin_name|default='ThinkCMF'} {:lang('ADMIN_CENTER')}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="__TMPL__/public/assets/themes/{:cmf_get_admin_style('arcoadmin')}/bootstrap5/bootstrap.min.css"
          rel="stylesheet">
    <link href="__TMPL__/public/assets/simpleboot/css/simplebootadmin.css" rel="stylesheet">
    <link href="__TMPL__/public/assets/fontawesome/css/all.min.css" rel="stylesheet" type="text/css">
    <link href="__TMPL__/public/assets/fontawesome/css/v4-shims.min.css" rel="stylesheet" type="text/css">
    <link href="__TMPL__/public/assets/themes/{:cmf_get_admin_style('arcoadmin')}/simplebootadminindex.min.css"
          rel="stylesheet">
    <style>
        html, body {
            height: 100%;
        }

        body {
            overflow: hidden;
            display: flex;
            align-items: stretch;
            flex-direction: column;
        }

        /*-----------------导航hack--------------------*/
        .nav-list > li.open {
            position: relative;
        }

        .nav-list > li.open .back {
            display: none;
        }

        .nav-list > li.open .normal {
            display: inline-block !important;
        }

        .nav-list > li.open a {
            padding-left: 7px;
        }

        .nav-list > li .submenu > li > a {
            background: #fff;
        }

        .nav-list > li .submenu > li a > [class*="fa-"]:first-child {
            left: 20px;
        }

        .nav-list > li ul.submenu ul.submenu > li a > [class*="fa-"]:first-child {
            left: 30px;
        }
    </style>
    <php>
        $_current_admin_id=cmf_get_current_admin_id();
        $_static_version='1.0.3';
    </php>
    <script>
        //全局变量
        var GV = {
            HOST: "{$_SERVER['HTTP_HOST']|default=''}",
            ROOT: "__ROOT__/",
            WEB_ROOT: "__WEB_ROOT__/",
            JS_ROOT: "static/js/",
            API_ROOT: {api: '__WEB_ROOT__/api/'},
            IS_MOBILE: {$_is_mobile? 'true' : 'false'},
            lang: function (langKey, params) {
                var lang = {
                    LOGIN_INVALID_TIPS: "{:lang('LOGIN_INVALID_TIPS')}",
                    'Please select at least one': "{:lang('Please select at least one')}",
                    Close: "{:lang('CLOSE')}",
                    'You sure you want to delete it?': "{:lang('You sure you want to delete it?')}",
                    'OK': "{:lang('OK')}",
                    'Are you sure you want to do this?': "{:lang('Are you sure you want to do this?')}"
                };
                return typeof lang[langKey] === 'undefined' ? langKey : lang[langKey];
            }
        };
    </script>
    <php>$submenus=$menus;</php>

    <php>
        if (!function_exists('getsubmenu')) {
        function getsubmenu($submenus){

    </php>
    <notempty name="submenus">
        <php>foreach($submenus as $menu){</php>
        <li>
            <php>
                $menu_name=lang($menu['lang']);
                $menu_name=$menu['lang']==$menu_name?$menu['name']:$menu_name;
                $icon_class='';
                if(str_contains($menu['icon'],'fa-')){
                $icon_class=$menu['icon'];
                }else{
                $icon_class=empty($menu['icon'])?'fa fa-desktop':'fa fa-'.$menu['icon'];
                }
            </php>
            <php>if(empty($menu['items'])){</php>
            <a href="javascript:openapp('{$menu.url}','{$menu.id}','{$menu_name}',true);">

                <i class="{$icon_class}"></i>
                <span class="menu-text"> {$menu_name} </span>
            </a>
            <php>}else{</php>
            <a href="#" class="cmf-dropdown-toggle">
                <i class="{$icon_class}"></i>
                <span class="menu-text normal"> {$menu_name} </span>
                <b class="arrow fa fa-angle-right normal"></b>
                <i class="fa fa-reply back"></i>
                <span class="menu-text back">{:lang('BACK')}</span>
            </a>

            <ul class="submenu">
                <php>getsubmenu1($menu['items'])</php>
            </ul>
            <php>}</php>

        </li>

        <php>}</php>
    </notempty>
    <php>
        }
        }
    </php>

    <php>
        if (!function_exists('getsubmenu1')) {
        function getsubmenu1($submenus){
    </php>
    <php>foreach($submenus as $menu){</php>
    <li>
        <php>
            $menu_name=lang($menu['lang']);
            $menu_name=$menu['lang']==$menu_name?$menu['name']:$menu_name;
        </php>
        <php>if(empty($menu['items'])){</php>
        <a href="javascript:openapp('{$menu.url}','{$menu.id}','{$menu_name}',true);">
            <i class="fa fa-caret-right"></i>
            <span class="menu-text">
									{$menu_name}
								</span>
        </a>
        <php>}else{</php>
        <a href="#" class="cmf-dropdown-toggle">
            <i class="fa fa-caret-right"></i>
            <span class="menu-text">
									{$menu_name}
								</span>
            <b class="arrow fa fa-angle-right"></b>
        </a>
        <ul class="submenu">
            <php>getsubmenu2($menu['items'])</php>
        </ul>
        <php>}</php>

    </li>

    <php>}</php>
    <php>}
        }
    </php>

    <php>
        if (!function_exists('getsubmenu2')) {
        function getsubmenu2($submenus){
    </php>
    <php>foreach($submenus as $menu){</php>
    <li>
        <php>
            $menu_name=lang($menu['lang']);
            $menu_name=$menu['lang']==$menu_name?$menu['name']:$menu_name;
        </php>

        <a href="javascript:openapp('{$menu.url}','{$menu.id}','{$menu_name}',true);">
            &nbsp;<i class="fa fa-angle-double-right"></i>
            <span class="menu-text">
								{$menu_name}
							</span>
        </a>
    </li>

    <php>}</php>
    <php>}
        }
    </php>


    <if condition="APP_DEBUG">
        <style>
            #think_page_trace_open {
                left: 0 !important;
                right: initial !important;
            }
        </style>
    </if>

</head>
<body style="min-width:{$_is_mobile?'auto':'900px'};overflow: hidden;" class="{$_is_mobile?'mobile':''}">
<div id="loading"><i class="loadingicon"></i><span>{:lang('LOADING')}</span></div>
<nav class="navbar navbar-expand-lg p-0" aria-label="Offcanvas navbar large">
    <div class="container-fluid g-0 me-3">
        <a class="navbar-brand m-0" href="{:url('admin/Index/index')}"
           style="min-width: 199px;text-align: center;font-weight: bold;">
            <empty name="$_admin_setting.admin_name">
                <img src="__TMPL__/public/assets/images/logo.svg" class="navbar-brand-logo"
                     style="height: 22px;display: inline-block;vertical-align: middle;border-radius: 4px;"/>
                <span style="display: inline-block;vertical-align: middle;" class="navbar-brand-name">
                    ThinkCMF
                </span>
                <else/>
                <span style="display: inline-block;vertical-align: middle;" class="navbar-brand-name">
                    {$_admin_setting.admin_name}
                </span>
            </empty>
        </a>
        <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNavbar"
                aria-controls="offcanvasNavbar">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse position-relative" id="navbarSupportedContent">
            <a id="task-pre" class="task-changebt"><i class="fa fa-chevron-left"></i></a>
            <div style="flex: 1;overflow: auto;width: 0;">
                <div id="task-content">
                    <ul class="cmf-component-tab" id="task-content-inner">
                        <li class="cmf-component-tabitem noclose" app-id="0" app-url="{:url('Main/index')}"
                            app-name="{:lang('HOME')}">
                            <a class="cmf-tabs-item-text">{:lang('HOME')}</a>
                        </li>
                    </ul>
                    <div style="clear:both;"></div>
                </div>
            </div>
            <div class="position-relative" style="padding-left: 30px;">
                <a id="task-next" class="task-changebt"><i class="fa fa-chevron-right"></i></a>
                <ul class="navbar-nav ms-auto nav simplewind-nav flex-nowrap">
                    <li class="light-blue" style="border-left:none;display: none;" id="close-all-tabs-btn">
                        <a id="close-wrapper" href="javascript:void(0);" title="{:lang('CLOSE_TOP_MENU')}"
                           style="font-size: 16px">
                            <i class="fa fa-times right_tool_icon"></i>
                        </a>
                    </li>
                    <li class="light-blue" style="border-left:none;">
                        <a id="refresh-wrapper" href="javacript:void(0);" title="{:lang('REFRESH_CURRENT_PAGE')}">
                            <i class="fa fa-refresh right_tool_icon"></i>
                        </a>
                    </li>
                    <if condition="cmf_admin_multi_lang()">
                        <php>
                            $admin_allow_lang_list=cmf_admin_allow_lang_list();
                            $current_lang=cmf_current_admin_lang();
                            $lang_setting=cmf_get_option('lang_setting');
                        </php>
                        <notempty name="$lang_setting['admin_allow_lang_list']"></notempty>
                        <li class="light-blue dropdown" style="border-left:none;">
                            <a href="javascript:" title=""
                               data-bs-toggle="dropdown" class="dropdown-toggle">
                                <i class="fa fa-language right_tool_icon"></i>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-end">
                                <foreach name="$lang_setting['admin_allow_lang_list']" item="lang">
                                    <li>
                                        <a class="dropdown-item"
                                           href="{:url('admin/Index/index')}?lang={$lang.lang}">{$lang.name|default=$lang.lang}</a>
                                    </li>
                                </foreach>
                            </ul>
                        </li>
                    </if>
                    <li class="light-blue dropdown" style="border-left:none;">
                        <a data-bs-toggle="dropdown" href="#" class="dropdown-toggle">
                            <if condition="isset($admin['avatar']) && $admin['avatar']">
                                <img class="nav-user-photo" width="30" height="30"
                                     src="{:cmf_get_user_avatar_url($admin['avatar'])}" alt="{$admin.user_login}">
                                <else/>
                                <img class="nav-user-photo" width="30" height="30"
                                     src="__TMPL__/public/assets/images/headicon_50.png"
                                     alt="{$admin.user_login|default=''}">
                            </if>
                            <span class="user-info">
								{:empty($admin['user_nickname'] ) ? $admin['user_login'] : $admin['user_nickname']}
						</span>
                        </a>
                        <ul class="user-menu dropdown-menu dropdown-menu-end">
                            <li>
                                <a class="dropdown-item"
                                   href="javascript:openapp('{:url('User/userinfo')}','index_userinfo','{:lang('ADMIN_USER_USERINFO')}',true);"><i
                                        class="fa fa-user fa-fw"></i> {:lang('ADMIN_USER_USERINFO')}</a></li>
                            <li>
                                <a class="dropdown-item"
                                   href="javascript:openapp('{:url('User/emailSetting')}','index_email_setting','{:lang('ADMIN_USER_EMAILSETTING')}',true);"><i
                                        class="fa fa-envelope fa-fw"></i> {:lang('ADMIN_USER_EMAILSETTING')}</a></li>
                            <li>
                                <a class="dropdown-item"
                                   href="javascript:openapp('{:url('Setting/password')}','index_password','{:lang('ADMIN_SETTING_PASSWORD')}',true);"><i
                                        class="fa fa-lock fa-fw"></i> {:lang('ADMIN_SETTING_PASSWORD')}</a></li>
                            <li>
                                <a class="dropdown-item" href="{:url('Public/logout')}"><i
                                        class="fa fa-sign-out fa-fw"></i>
                                    {:lang('LOGOUT')}</a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</nav>
<notempty name="$_is_mobile">
    <div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasNavbar" aria-labelledby="offcanvasNavbarLabel"
         style="width: 300px;">
        <div class="offcanvas-header">
            <h5 class="offcanvas-title" id="offcanvasNavbarLabel">
                <empty name="$_admin_setting.admin_name">
                    <img src="__TMPL__/public/assets/images/logo.svg" class="navbar-brand-logo"
                         style="height: 22px;display: inline-block;vertical-align: middle;border-radius: 4px;"/>
                    <span style="display: inline-block;vertical-align: middle;" class="navbar-brand-name">
                    ThinkCMF
                </span>
                    <else/>
                    <span style="display: inline-block;vertical-align: middle;" class="navbar-brand-name">
                    {$_admin_setting.admin_name}
                </span>
                </empty>
            </h5>
            <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
        </div>
        <div class="sidebar-shortcuts">
            <a class="btn btn-sm btn-outline-light" href="__ROOT__/"
               title="{:lang('WEBSITE_HOME_PAGE')}"
               target="_blank"
               data-toggle="tooltip">
                <i class="fa fa-home"></i>
            </a>
            <if condition="cmf_auth_check(cmf_get_current_admin_id(),'user/AdminAsset/index')">
                <a class="btn btn-sm btn-info"
                   href="javascript:openapp('{:url('user/AdminAsset/index')}','userAdminAssetindex','{:lang('USER_ADMINASSET_INDEX')}',true);"
                   title="{:lang('USER_ADMINASSET_INDEX')}"
                   data-toggle="tooltip">
                    <i class="fa fa-file"></i>
                </a>
            </if>

            <if condition="cmf_auth_check(cmf_get_current_admin_id(),'admin/Setting/clearcache')">
                <a class="btn btn-sm btn-danger"
                   href="javascript:openapp('{:url('admin/Setting/clearcache')}','index_clearcache','{:lang('ADMIN_SETTING_CLEARCACHE')}',true);"
                   title="{:lang('ADMIN_SETTING_CLEARCACHE')}"
                   data-toggle="tooltip">
                    <i class="fa fa-trash-o"></i>
                </a>
            </if>

            <if condition="cmf_auth_check(cmf_get_current_admin_id(),'admin/RecycleBin/index')">
                <a class="btn btn-sm btn-warning"
                   href="javascript:openapp('{:url('admin/RecycleBin/index')}','index_recycle','{:lang('ADMIN_RECYCLEBIN_INDEX')}',true);"
                   title="{:lang('ADMIN_RECYCLEBIN_INDEX')}"
                   data-toggle="tooltip">
                    <i class="fa fa-recycle"></i>
                </a>
            </if>
            <php>
                $dev_menu_display='none';
                if(APP_DEBUG){
                $dev_menu_display='inline-block';
                }
            </php>
            <a class="btn btn-sm btn-default"
               id="dev-menu-button"
               style="display: {$dev_menu_display};"
               href="javascript:openapp('{:url('admin/Dev/index')}','index_dev','{:lang('ADMIN_DEV_INDEX')}',true);"
               title="{:lang('ADMIN_DEV_INDEX')}"
               data-toggle="tooltip">
                <i class="fa fa-terminal"></i>
            </a>

        </div>
        <div class="offcanvas-body p-0">
            <ul class="nav-list">
                {:getsubmenu($submenus)}
            </ul>
        </div>
    </div>
</notempty>
<div class="main-container container-fluid" style="flex: 1;height: 0;">
    <empty name="$_is_mobile">
        <div class="sidebar" id="sidebar">
            <div class="sidebar-shortcuts" id="sidebar-shortcuts">
                <a class="btn btn-sm btn-outline-light" href="__ROOT__/"
                   title="{:lang('WEBSITE_HOME_PAGE')}"
                   target="_blank"
                   data-toggle="tooltip">
                    <i class="fa fa-home"></i>
                </a>
                <if condition="cmf_auth_check(cmf_get_current_admin_id(),'user/AdminAsset/index')">
                    <a class="btn btn-sm btn-info"
                       href="javascript:openapp('{:url('user/AdminAsset/index')}','userAdminAssetindex','{:lang('USER_ADMINASSET_INDEX')}',true);"
                       title="{:lang('USER_ADMINASSET_INDEX')}"
                       data-toggle="tooltip">
                        <i class="fa fa-file"></i>
                    </a>
                </if>

                <if condition="cmf_auth_check(cmf_get_current_admin_id(),'admin/Setting/clearcache')">
                    <a class="btn btn-sm btn-danger"
                       href="javascript:openapp('{:url('admin/Setting/clearcache')}','index_clearcache','{:lang('ADMIN_SETTING_CLEARCACHE')}',true);"
                       title="{:lang('ADMIN_SETTING_CLEARCACHE')}"
                       data-toggle="tooltip">
                        <i class="fa fa-trash-o"></i>
                    </a>
                </if>

                <if condition="cmf_auth_check(cmf_get_current_admin_id(),'admin/RecycleBin/index')">
                    <a class="btn btn-sm btn-warning"
                       href="javascript:openapp('{:url('admin/RecycleBin/index')}','index_recycle','{:lang('ADMIN_RECYCLEBIN_INDEX')}',true);"
                       title="{:lang('ADMIN_RECYCLEBIN_INDEX')}"
                       data-toggle="tooltip">
                        <i class="fa fa-recycle"></i>
                    </a>
                </if>

                <php>
                    $dev_menu_display='none';
                    if(APP_DEBUG){
                    $dev_menu_display='inline-block';
                    }
                </php>
                <a class="btn btn-sm btn-default"
                   id="dev-menu-button"
                   style="display: {$dev_menu_display};"
                   href="javascript:openapp('{:url('admin/Dev/index')}','index_dev','{:lang('ADMIN_DEV_INDEX')}',true);"
                   title="{:lang('ADMIN_DEV_INDEX')}"
                   data-toggle="tooltip">
                    <i class="fa fa-terminal"></i>
                </a>

            </div>
            <div id="nav-wrapper">
                <ul class="nav-list">
                    {:getsubmenu($submenus)}
                </ul>
            </div>
        </div>
    </empty>

    <div class="main-content">
        <div class="page-content" id="content">
            <iframe src="{:url('Main/index')}" style="width:100%;height: 100%;" frameborder="0" id="appiframe-0"
                    class="appiframe"></iframe>
        </div>
    </div>
</div>
<script src="__TMPL__/public/assets/js/jquery-3.6.4.min.js"></script>
<script src="__TMPL__/public/assets/js/jquery-migrate-3.4.0.min.js"></script>
<script src="__TMPL__/public/assets/js/bootstrap5/popper.min.js"></script>
<script src="__TMPL__/public/assets/js/bootstrap5/bootstrap.min.js"></script>
<script src="__STATIC__/js/wind.js"></script>
<script src="__STATIC__/js/admin.js?v={$_static_version}"></script>
<script src="__TMPL__/public/assets/simpleboot/js/adminindex.js?v={$_static_version}"></script>
<script>
    Wind.css('artDialog');
    $(function () {
        $("[data-toggle='tooltip']").tooltip({container: 'body'});
        $("li.dropdown").hover(function () {
            $(this).addClass("open");
        }, function () {
            $(this).removeClass("open");
        });

        var menus = {$menus_js_var};
        //读取url参数。尝试执行菜单功能。
        if (typeof (menus) != "undefined") {

            var tw     = window.top;
            var twa    = tw.location.href.split("#");
            var url    = twa[1];
            var urlTmp = url;
            if (url != null) {
                //去掉/ 去掉_ 全部小写。
                urlTmp   = urlTmp.replace(/[\\/|_|]/g, "");
                urlTmp   = urlTmp.replace(".html", "");
                urlTmp   = urlTmp.toLowerCase();
                var menu = menus[urlTmp];
                if (menu) {
                    openapp(url, menu.id + menu.app, menu.name, true);
                }
            }
        }


    });

    var ismenumin = $("#sidebar").hasClass("menu-min");
    $(".nav-list").on("click", function (event) {
        var closest_a = $(event.target).closest("a");
        if (!closest_a || closest_a.length == 0) {
            return
        }
        if (!closest_a.hasClass("cmf-dropdown-toggle")) {
            if (ismenumin && "click" == "tap" && closest_a.get(0).parentNode.parentNode == this) {
                var closest_a_menu_text = closest_a.find(".menu-text").get(0);
                if (event.target != closest_a_menu_text && !$.contains(closest_a_menu_text, event.target)) {
                    return false
                }
            }
            return
        }
        var closest_a_next = closest_a.next().get(0);
        if (!$(closest_a_next).is(":visible")) {
            var closest_ul = $(closest_a_next.parentNode).closest("ul");
            if (ismenumin && closest_ul.hasClass("nav-list")) {
                return
            }
            closest_ul.find("> .open > .submenu").each(function () {
                if (this != closest_a_next && !$(this.parentNode).hasClass("active")) {
                    $(this).slideUp(150).parent().removeClass("open")
                }
            });
        }
        if (ismenumin && $(closest_a_next.parentNode.parentNode).hasClass("nav-list")) {
            return false;
        }
        $(closest_a_next).slideToggle(150).parent().toggleClass("open");
        return false;
    });

    var consoleOpened = false;

    function isConsoleOpen() {
        if (consoleOpened) {
            return consoleOpened;
        }
        var startTime = new Date().getTime();
        debugger;
        var endTime = new Date().getTime();

        return endTime - startTime > 100;
    }

    var openDevTipsTimes = 0;
    var openDevTipsTimer = null;

    function openDevTips() {
        consoleOpened = true;
        if (openDevTipsTimes < 20) {
            console.log('{:lang("Open the dev panel, please execute")}')
            console.log("$('#dev-menu-button').show();openapp('/admin/dev/index.html','index_dev','{:lang('ADMIN_DEV_INDEX')}',true);");
        } else {
            clearInterval(openDevTipsTimer);
        }
        openDevTipsTimes++;
    }

    openDevTipsTimer = setInterval(openDevTips, 5000);
    openDevTips();


</script>
</body>
</html>
